package cn.edu.hbwe.book.admin.servlet.notices;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import cn.edu.hbwe.book.admin.service.notices.NoticesService;
import cn.edu.hbwe.book.entity.Notice;

/**
 * Servlet implementation class NoticeListServlet
 */
public class NoticeListServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		doPost(request, response);
	}
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		NoticesService nService = new NoticesService();
		List<Notice> notices = nService.getAllNotices();
		request.setAttribute("notices", notices);
		request.getRequestDispatcher("/admin/notices/list.jsp").forward(request, response);
	}

}
